import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        component: HomeView,
    },
    {
        path: '/reg',
        component: () => import( '../views/reg.vue')
    },

    {
        path: '/adminLogin',
        component: () => import( '../views/adminLogin.vue'),
    },

    {
        path: '/UserIndex',
        component: () => import( '../views/UserIndex.vue'),
        children: [
            {
                path: '/carInfo',
                component: () => import('../views/carInfo.vue'),
            },
            {
                path: '/FreeSpace',
                component: () => import('../views/FreeSpace.vue'),
            },
            {
                path: '/MyCar',
                component: () => import('../views/MyCar.vue'),
            },
            {
                path: '/UserInformation',
                component: () => import('../views/UserInformation .vue'),
            },
            {
                path: '/AddNewCar',
                component: () => import('../views/AddNewCar.vue'),
            },
            {
                path: '/SpaceOccupancy',
                component: () => import('../views/SpaceOccupancy.vue'),
            },
            {
                path: '/allageTable',
                component: () => import('../views/allegeTable.vue'),
            },
            {
                path: '/hanleAllageTable',
                component: () => import('../views/handleAllegeTable.vue'),
            },
            {
                path: '/StopHistory',
                component: () => import('../views/StopHistory.vue'),
            }
        ]
    },

    {
        path: '/admin',
        component: () => import( '../views/admin.vue'),
        children: [
            {
                path: '/index',
                component: () => import('../views/index.vue'),
                children: [
                    {
                        path: '/AdminStopHistory',
                        component: () => import('../views/AdminStopHistory.vue'),
                    },
                    {
                        path: '/adminAllegaTable',
                        component: () => import('../views/adminAllegeTable.vue'),
                    },
                    {
                        path: '/adminHandleAllegeTable',
                        component: () => import('../views/adminHandleAllegeTable.vue'),
                    },
                    {
                        path: '/AdminFreeSpace',
                        component: () => import('../views/AdminFreeSpace.vue'),
                    },
                    {
                        path: '/MyCar',
                        component: () => import('../views/MyCar.vue'),
                    },
                    {
                        path: '/UserInformation',
                        component: () => import('../views/UserInformation .vue'),
                    }, {
                        path: '/AdminCount',
                        component: () => import('../views/AdminCount.vue'),
                    }

                ]
            },
            {
                path: '/monthUserTable',
                component: () => import('../views/MonthUserTable.vue'),
            },
            {
                path: '/addMonthUser',
                component: () => import('../views/addMonthUser.vue'),
            },
            {
                path: '/addAdminUser',
                component: () => import('../views/addAdminUser.vue'),
            },
            {
                path: '/adminTable',
                component: () => import('../views/AdminTable.vue'),
            },
            {
                path: '/ParkingSpaceTableOne',
                component: () => import('../views/ParkingSpaceTableOne.vue'),
            },
            {
                path: '/ParkingSpaceTableTow',
                component: () => import('../views/ParkingSpaceTableTow.vue'),
            },
            {
                path: '/ParkingSpaceTableThree',
                component: () => import('../views/ParkingSpaceTableThree.vue'),
            },
            {
                path: '/carIn',
                component: () => import('../views/carIn.vue'),
            },
            {
                path: '/carOut',
                component: () => import('../views/carOut.vue'),
            },
            {
                path: '/blackList',
                component: () => import('../views/BlackList.vue'),
            },
        ]
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
